<% template_invocations = job_invocation.pattern_template_invocations %>
<div class='row'>
  <div class="col-xs-6 col-sm-6 col-md-6">
    <%= render :partial => 'card_results', :locals => { :job_invocation => job_invocation } %>
    <%= render :partial => 'card_schedule', :locals => { :job_invocation => job_invocation } %>
  </div>
  <div class='col-xs-12 col-sm-6 col-md-6'>
  <%= render :partial => 'card_target_hosts', :locals => { :job_invocation => job_invocation } %>
  <% template_invocations.each do |template_invocation| %>
    <%= minicard('user', template_invocation.effective_user || Setting[:remote_execution_effective_user],
                 template_invocation.template.name + ' ' + _('effective user')) %>
    <div class="row">
      <% missing = job_invocation.missing_hosts_count %>
      <% size = missing.zero? ? 12 : 6 %>
      <div class="col-xs-12 col-sm-<%= size %> col-md-<%= size %>" >
        <%= minicard('cluster', job_invocation.total_hosts_count, _('Total hosts')) %>
      </div>
      <% unless missing.zero? %>
      <div class="col-xs-12 col-sm-6 col-md-6" >
          <%= minicard('warning-triangle-o', missing, _('Hosts gone missing'),
                       :tooltip => _('This can happen if the host is removed or moved to another organization or location after the job was started')) %>
      </div>
    <% end %>
    </div>
    <% if template_invocation.input_values.present? %>
      <%= render :partial => 'card_user_input', :locals => { :template_invocation => template_invocation } %>
    <% end %>
  <% end %>
  </div>
</div>
<hr/>
<% if job_invocation.resolved? %>
  <div id="hosts" data-refresh_required="<%= job_invocation.resolved? ? '' : 'true' %>">
    <%= render :partial => 'tab_hosts', :locals => { :job_invocation => job_invocation, :hosts => hosts } %>
  </div>
<% else %>
  <div class="alert alert-warning">
    <%= _("The dynamic query '#{job_invocation.targeting.search_query}' was not resolved yet. The list of hosts to which it would resolve now can be seen") %>
    <%= link_to('here.', hosts_url(:search => job_invocation.targeting.search_query)) %>
  </div>
<% end %>
